<template>
    <div>
        <el-table
                v-loading="$store.state.isLoading"
                :border="true"
                :data="content"
                style="width: 100%">
            <el-table-column label="姓名" width="250">
                <template slot-scope="scope">
                    {{scope.row.name}}
                </template>
            </el-table-column>

            <el-table-column
                label="请假原因"
                width="380">
                <template slot-scope="scope">
                    <el-popover trigger="hover" placement="top">
                    <p>请假原因: {{ scope.row.content }}</p>
                    <div slot="reference" class="name-wrapper">
                        <el-tag size="medium">{{scope.row.content}}</el-tag>
                    </div>
                    </el-popover>
                </template>
            </el-table-column>

            <el-table-column
                    label="请假时间"
                    width="200">
                <template slot-scope="scope">
                    <i class="el-icon-time"></i>
                    <span style="margin-left: 10px">{{ scope.row.askForLeaveTime | date }}</span>
                </template>
            </el-table-column>
        
            <el-table-column label="状态">
                <template slot-scope="scope">
                    <span>{{ scope.row.status===1?"请求中":scope.row.status===2?"已批准":"未批准" }}</span>
                </template>
            </el-table-column>
        </el-table>
        <PageInfo actions-name="getAddContent"></PageInfo>
    </div>
</template>

<script>
    export default {
        data(){
            return {
                content:[]
            }
        },
        async created(){
           await this.$store.dispatch("getAddContent",{pageIndex:1})
            // console.log(this.$store.state.askForLeave.content)
             for(let key in this.$store.state.askForLeave.content){
                // console.log(this.$store.state.askForLeave.content[key])
                if(this.$store.state.askForLeave.content[key].name===localStorage.adminName){
                       this.content.push(this.$store.state.askForLeave.content[key])
                      
                }
            }
            //  console.log(this.content)
        }
    }
</script>

<style lang="scss" scoped>

</style>